package utiliy

object UnitChangePercent {
  def to_g(unit: String): Double = unit match {
    case "kg" => 1000
    case "ton" => 1000000
    case "g" => 1
    case _ => 0
  }

  def to_kg(unit: String): Double = unit match {
    case "kg" => 1
    case "t" => 1000
    case "g" => 0.001
    case _ => 0
  }

  def to_m(unit: String): Double = unit match {
    case "cm" => 0.01
    case "mm" => 0.001
    case "m" => 1.0
    case "km" => 1000.0
    case _ => 0.0
  }

  def to_cm(unit: String): Double = unit match {
    case "cm" => 1.0
    case "mm" => 0.1
    case "m" => 100
    case "km" => 1000_00
    case _ => 0.0
  }

  def to_mm(unit: String): Double = unit match {
    case "cm" => 10
    case "mm" => 1
    case "m" => 1000
    case "km" => 1000_000
    case _ => 0.0
  }

}
